package site.yunnong.atvris.common.api;

/**
 * @author zjh
 * @date 2021/7/17 20:01
 */
public class Result {

    protected Integer code;

    protected String message;

    public Result() {

    }
    public Result fail() {
        return this.fail(ResultCodeEnum.ERROR_BUSINESS);
    }

    public Result fail(ResultCodeEnum resultCode) {
        return this.fail(resultCode, resultCode.getMessage());
    }

    public Result fail(String message) {
        return this.fail(ResultCodeEnum.ERROR_SERVER, message);
    }

    public Result fail(ResultCodeEnum resultCode, String message) {
        this.code = resultCode.getCode();
        this.message = message;
        return this;
    }

    public Result fail(Integer code, String message) {
        this.code = code;
        this.message = message;
        return this;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMessage() {
        return this.message;
    }
}
